Test Series - java script

Test Number 36/92

Q: When are the mouse events generated?
A. When user clicks the mouse over a document
B. When user moves over a document
C. On pressing a key
D. When user clicks or moves the mouse over a document
Solution: Mouse events are generated when the user moves or clicks the mouse over a document. These events are triggered on the most deeply nested element that the mouse pointer is over, but they bubble up through the document.
Q: The properties that specify the position and button state of the mouse are _________
A. clientX and clientY
B. clientY and clientX
C. altKey and ctrlKey
D. metaKey and shiftKey
Solution: The clientX and clientY properties specify the position of the mouse in window coordinates. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered. Similarly clientY returns the vertical coordinates.
Q: Which of the following keys are not set to true when the keyboard modifier keys are held down?
A. altKey
B. ctrlKey
C. metaKey
D. delkey
Solution: A modifier key is a key that modifies the action of another key when the two are pressed together. The altKey, ctrlKey, metaKey, and shiftKey properties are set to true when the corresponding keyboard modifier keys are held down.
Q: How to detect and respond to mouse drags?
A. Registering a mouseover handler
B. Releasing a mousedown handler
C. Registering a mousedown handler
D. Releasing a mouseover handler
Solution: By registering a mousedown handler that registers a mousemove handler, you can detect and respond to mouse drags. Doing this properly involves being able to capture mouse events so that you continue to receive mousemove events even when the mouse has moved out of the element it started in.
Q: When is the mouseover event fired?
A. When mouse is moved over a new element
B. When mouse is clicked
C. When mouse is both moved and clicked
D. When mouse is released
Solution: When the user moves the mouse so that it goes over a new element, the browser fires a mouseover event on that element. The onmouseover event occurs when the mouse pointer is moved onto an element, or onto one of its children.
Q: When is the mouseout event fired?
A. When mouse is no longer over an element
B. When mouse is over an element
C. When mouse is hovered
D. When mouse is clicked
Solution: When the mouse moves so that it is no longer over an element, the browser fires a mouseout event on that element. The mouseout() method triggers the mouseout event, or attaches a function to run when a mouseout event occurs
Q: The focus and blur events are also part of _________
A. Element events
B. Handler events
C. Window events
D. Scroll events
Solution: The focus and blur events are also used as Window events: they are triggered on a window when that browser window receives or loses keyboard focus from the operating system. Focusin and onblur methods are used for using these events.
Q: The element that can also register handlers for load and error events is _________
A. html
B. img
C. body
D. form
Solution: Individual document elements, such as img elements, can also register handlers for load and error events.onload and onerror methods are used for handling such events.
Q: The events that are emulated by the jQuery library are _________
A. focusarea and focusover
B. focusall and focusnone
C. focusdown and focusup
D. focusin and focusout
Solution: The jQuery library emulates focusin and focusout events for browsers that do not support them. The focusin and focusout events bubble, the focus and blur events doesn’t. That means that you can use the focusin and focusout on the parent element of a form field.
Q: Which event is triggered sooner when the document and its elements are ready to manipulate?
A. DOMContentLoaded
B. readystatechange
C. Both DOMContentLoaded & readystatechange
D. Statechange
Solution: DOMContentLoaded and readystatechange are alternatives to the load event: they are triggered sooner, when the document and its elements are ready to manipulate, but before external resources are fully loaded.

You Have Score    /10